package com.intelli4.pos.core;

import java.util.Calendar;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.ForeignKey;

@Entity
public class Session {
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;
	@ManyToOne(optional = false, fetch = FetchType.LAZY)
	@JoinColumn(name = "shiftId")
	@ForeignKey(name = "Session_ShiftFK")
	private Shift shift;
	@ManyToOne(optional = false, fetch = FetchType.LAZY)
	@JoinColumn(name = "operatorId")
	@ForeignKey(name = "Session_OperatorFK")
	private Operator operator;
	@ManyToOne(optional = false, fetch = FetchType.LAZY)
	@JoinColumn(name = "terminalId")
	@ForeignKey(name = "Session_TerminalFK")
	private Terminal terminal;
	@Column(nullable = false)
	@Temporal(TemporalType.TIMESTAMP)
	private Calendar startTime;
	@Column(nullable = false)
	@Temporal(TemporalType.TIMESTAMP)
	private Calendar endTime;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Shift getShift() {
		return shift;
	}

	public void setShift(Shift shift) {
		this.shift = shift;
	}

	public Operator getOperator() {
		return operator;
	}

	public void setOperator(Operator operator) {
		this.operator = operator;
	}

	public Terminal getTerminal() {
		return terminal;
	}

	public void setTerminal(Terminal terminal) {
		this.terminal = terminal;
	}

	public Calendar getStartTime() {
		return startTime;
	}

	public void setStartTime(Calendar startTime) {
		this.startTime = startTime;
	}

	public Calendar getEndTime() {
		return endTime;
	}

	public void setEndTime(Calendar endTime) {
		this.endTime = endTime;
	}

}
